package com.atguigu.yygh.enums;

public enum StatusEnum {
    NOMAL(1,"正常"),
    LOCK(0,"锁定");

    private Integer status;
    private String statusString;

    StatusEnum(Integer status, String statusString) {
        this.status = status;
        this.statusString = statusString;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public String getStatusString() {
        return statusString;
    }

    public void setStatusString(String statusString) {
        this.statusString = statusString;
    }

    public static String getStatusStringByStatus(Integer status){
        StatusEnum[] values = StatusEnum.values();
        for (StatusEnum value : values) {
            if(status.intValue() == value.getStatus().intValue()){
                return value.statusString;
            }
        }
        return null;
    }

    @Override
    public String toString() {
        return "StatusEnum{" +
                "status=" + status +
                ", statusString='" + statusString + '\'' +
                '}';
    }
}
